﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DatabaseSimulation
{
    public abstract class DatabaseResource
    {
        public DatabaseOperation CurrentOperation { get; private set; }

        public void SetOperation(DatabaseOperation operation)
        {
            if (this.CurrentOperation == null)
            {
                this.CurrentOperation = operation;
            }
            else
            {
                throw new Exception("");
            }
        }

        public void ReleaseOperation(DatabaseOperation operation)
        {
            if (this.CurrentOperation == operation)
            {
                this.CurrentOperation = null;
            }
            else
            {
                throw new Exception("");
            }
        }
    }
}
